import defaultImg from '@/components/defaultImg/defaultImg.vue' //默认图片组件
export default {
  components: {
    defaultImg
  },
  data() {
    return {
      pageindex: 1,
      iexpList: [], //列表
      pagecont: 0,
      showimg: true,
      defaultImg: false, //默认图
      more: true
    }
  },
  // 上拉加载分页
  onReachBottom() {
    this.GetStatementList()
  },
  created() {
    this.GetStatementList()
  },
  methods: {
    moreStatus(status) {
		  this.more = status
    },
    clickLoadMore(){
      this.GetStatementList()
    },
    async GetStatementList() {
      this.more = 'loading'
      try {
        const res = await this.$api.user.GetStatementList({
          pageIndex: this.pageindex,
          pageSize: 10
        })
        this.iexpList = [...this.iexpList, ...res.data.list]
        this.iexpList.forEach(item => {
				  item.moneyXin = parseFloat(item.money)
        })
        if(this.iexpList.length===0){
				  this.defaultImg = true
        }else{
				  this.defaultImg = false
        }
        if (res.data.total <= 10) {
          this.more = 'nomore'
        } else {
          this.moreStatus(res.data.list.length !== 0 ? 'loadmore' : 'nomore')
        }
        if (res.data.list.length === 0) return false
        this.pageindex += 1 // 当前页加1

      } catch (err) {}
    },
    //跳转详情
    ieClick(type) {
      uni.navigateTo({
        url: '/pages_userModule/incomeExpenditurDetails/incomeExpenditurDetails?ieid=' + type.moneyId
      })
    }
  }
}
